<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../resources/dump-as-markup.js"></script>
</head>
<body>
<div style="direction: rtl;" contenteditable="true" id="test1">1234שדגכ:</div>

<div contenteditable="true" id="test2">
<div>1234שדגכ:</div>
<div style="direction: rtl;">1234שדגכ:</div>
</div>

<script>

Markup.description('These tests to see if bidi text with a base writing direction of right to left is put onto the paste board in logical (DOM) order.');

var e = document.getElementById("test1");
var s = window.getSelection();

Markup.dump('test1', 'first test - before');
s.collapse(e, 0);
document.execCommand("SelectAll");
document.execCommand("Cut");
document.execCommand("Paste");
Markup.dump('test1', 'first test - after');

Markup.dump('test2', 'second test - before');
e = document.getElementById("test2");
s.collapse(e, 0);
document.execCommand("SelectAll");
document.execCommand("Cut");
document.execCommand("Paste");
Markup.dump('test2', 'second test - after');

</script>
</body>
</html>
